import { unref } from 'vue'

const submitForm = async () => {
  const form = unref(ruleFormRef)
  if (!form) {
    return
  }
  try {
    await form.validate()
    // console.log('登录成功')
    const { data } = await login(ruleForm)
    console.log(data)
    ElMessage.success('登录成功')
  } catch (err) {
    console.log(err)
  }
}

const resetForm = () => {
  const form = unref(ruleFormRef)
  form.resetFields()
}

export { submitForm, resetForm }
